package com.hzw.saas.web.app.app.controller;

import com.hzw.saas.api.app.bo.AppHeartbeat;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Date;

/**
 * @author zzl
 * @since 03/29/2021
 */
@Controller
@Api(tags = "应用状态")
public class HealthController {

    @GetMapping("/app/health/heartbeat")
    @ApiOperation(value = "监测应用心跳", notes = "监测应用心跳")
    @ApiResponses({
        @ApiResponse(code = 200, message = "应用运行正常")
    })
    public ResponseEntity<AppHeartbeat> getHeartbeat() {
        AppHeartbeat heartbeat = new AppHeartbeat()
            .setTime(new Date());
        return ResponseEntity.ok(heartbeat);
    }

}
